package pl.smath.operation.basic;

import junit.framework.TestCase;
import pl.smath.expression.ExponentiationTerm;
import pl.smath.expression.Term;
import pl.smath.operation.BasicOp;
import pl.smath.parser.ExpressionParser;


public class ExpMultiplyTestCase extends TestCase {

	/** 
	 * Test data. Format:
	 * input => expected output 
	 */
	private static final String[][] testData = {
		 {"(2*3)^3","2^3*3^3"},
         {"(a*b)^c","a^c*b^c"},
         {"(a/b)^c","a^c/b^c"}
	};
	
	
	public void testData() {
		ExpressionParser parser = new ExpressionParser();
		Term	input;
		Term	output;
		
		for(int i = 0; i < testData.length; i++){
//System.out.println(testData[i][0]);		
			input = parser.parseText( testData[i][0] );
			if(input instanceof ExponentiationTerm){
				ExponentiationTerm term = (ExponentiationTerm)input;
				output = BasicOp.expMultiply(term);
			}
			else{
				output = input;
			}
			
			assertEquals("Input: " + testData[i][0], testData[i][1], output.toString());
		}
	}

}
